package com.mdxq.mall.user.study;

import feign.Response;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/config")
@RefreshScope
public class ConfigTestController {
    @Value("${app.env}")
    private String appEnv;//保存我们刚刚添加到配置中心的内容
    @GetMapping("/a")
    public ResponseEntity<String> a(){
        if(appEnv != null){
            return ResponseEntity.ok("当前应用环境"+appEnv);
        }else {
            return ResponseEntity.notFound().build();
        }
    }

}
